package webapp.mvc.services;

import com.zoowii.jpa_utils.extension.Paginator;
import webapp.mvc.controllers.forms.CreateProductForm;
import webapp.mvc.controllers.forms.UpdateProductForm;
import webapp.mvc.exceptions.ProductException;
import webapp.mvc.models.CommentEntity;
import webapp.mvc.models.ProductChangeRequestEntity;
import webapp.mvc.models.ProductEntity;

import java.util.List;

public interface IProductService {
    List<ProductEntity> getProducts(String shopId, Paginator paginator);
    List<ProductEntity> searchProducts(String keyword, Paginator paginator);

    List<ProductChangeRequestEntity> getProductChangeRequests(Paginator paginator);

    ProductEntity agreeProductChangeRequest(String requestId);

    ProductChangeRequestEntity disagreeProductChangeRequest(String requestId);

    ProductEntity createProduct(String requestUserId, CreateProductForm createProductForm) throws ProductException;

    ProductEntity updateProduct(String requestUserId, String productId, UpdateProductForm updateProductForm) throws ProductException;
    ProductEntity findById(String id);
    List<CommentEntity> getProductLatestComments(String productId, int limit);
    List<CommentEntity> getComments(String productId, Paginator paginator);
    void deleteComments(List<String> ids);
    CommentEntity createProductComment(String userId, String productId, String title, String content) throws ProductException;
    void collectProduct(String productId, String userId);
    void unCollectProduct(String productId, String userId);
    boolean isCollectedProduct(String productId, String userId);
    List<ProductEntity> getUserCollectedProducts(String userId, Paginator paginator);

    /**
     * 获取热门商品
     * @param limit
     * @return
     */
    List<ProductEntity> getHotestProducts(int limit);
}
